<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="my" uri="/mytags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>社会资助数据统计</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/asserts/bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
	
		<!-- js插件 -->
		<script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script>
		<script src="${pageContext.request.contextPath}/asserts/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/asserts/bootstrapValidate/css/bootstrapValidator.min.css"/>
 	   <script src="${pageContext.request.contextPath}/asserts/bootstrapValidate/js/bootstrapValidator.min.js"></script>
	
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/asserts/datetimepicker/css/bootstrap-datetimepicker.css"/>
	 	   <script src="${pageContext.request.contextPath}/asserts/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
	<script src="${pageContext.request.contextPath}/asserts/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
	</head>
	<body>
			<!-- 内容展示区 -->
			 
					<!-- 导航 -->
					<ol class="breadcrumb">
						<li><i class="fa fa-comment"></i>社会资助归档统计</li>
					</ol>
					<div class="container-fluid">
						<!-- 	内容面板 -->
						<div class="panel panel-default">
 
							<div class="panel-body">
								<form id="myform" action="${pageContext.request.contextPath}/datatotal/listsocietysub" method="post"  class="form-horizontal" >
								      <div class="form-group">
								      		<label class="control-label col-md-2">学年(开始时间)：</label>
										<div class="col-md-3" >
											  <input type="text" name="beginDate"  id="beginDate" value="<fmt:formatDate value="${dataTotal.beginDate}" pattern="yyyy-MM-dd" />" data-date-format="yyyy-MM-dd"
         				    			  class="form-control input-inline form_time" placeholder="请选择开始时间"  readonly="readonly">
 
											 
										</div>
										<label class="control-label col-md-2">学年(结束时间)：</label>
										<div class="col-md-3" id="endDate">
											  <input type="text" name="endDate" id="endDate" value="<fmt:formatDate value="${dataTotal.endDate}" pattern="yyyy-MM-dd" />" data-date-format="yyyy-MM-dd"
          						     class="form-control input-inline form_time" placeholder="请选择结束时间" readonly="readonly">
 
										</div>
								      </div>
								      <div class="form-group">
								      	<label class="control-label col-md-2">资助项目：</label>
										<div class="col-md-3">
											 <input type="text" id="subname" name="subname" value="${dataTotal.project}" class="form-control"/>
										</div>
										 <label class="control-label col-md-2">学期：</label>
										<div class="col-md-3">
											 	<select id="term" name="term" class="form-control">
													<option value="">请选择</option>
													<option value="2019年秋季学期" <c:if test="${dataTotal.term=='2019年秋季学期' }">selected</c:if>>2019年秋季学期</option>
													<option value="2020年春季学期" <c:if test="${dataTotal.term=='2020年春季学期' }">selected</c:if>>2020年春季学期</option>
											 		<option value="2020年秋季学期" <c:if test="${dataTotal.term=='2020年秋季学期' }">selected</c:if>>2020年秋季学期</option>
													<option value="2021年春季学期" <c:if test="${dataTotal.term=='2021年春季学期' }">selected</c:if>>2021年春季学期</option>
													<option value="2021年秋季学期" <c:if test="${dataTotal.term=='2021年秋季学期' }">selected</c:if>>2021年秋季学期</option>
													<option value="2022年春季学期" <c:if test="${dataTotal.term=='2022年春季学期' }">selected</c:if>>2022年春季学期</option>
													<option value="2022年秋季学期" <c:if test="${dataTotal.term=='2022年秋季学期' }">selected</c:if>>2022年秋季学期</option>
													<option value="2023年春季学期" <c:if test="${dataTotal.term=='2023年春季学期' }">selected</c:if>>2023年春季学期</option>
												</select>
										
										</div>
									
								      </div>
								     
								     <div class="form-group">
								    	 <label class="control-label col-md-2">乡镇：</label>
											<div class="col-md-3">
												 		  <select id="zid" name="zid" class="form-control" onchange="changeZhen(this)">
															<option value="">请选择</option>
														</select>
											</div>
										<label class="control-label col-md-2">所在学校：</label>
										<div class="col-md-3">
											 <select id="schoolname" name="schoolname" class="form-control">
												<option value="">请选择</option>
											</select> 
										</div>
										
									</div>
									 <div class="form-group">
										 <label class="control-label col-md-2">姓名：</label>
										<div class="col-md-3">
											 		<input type="text" id="name" name="name" value="${dataTotal.name}" class="form-control"/>
										</div>
										
										<label class="control-label col-md-2">身份证号：</label>
										<div class="col-md-3">
												<input type="text" id="idcard" name="idcard" value="${dataTotal.idcard }" class="form-control"/>
										</div>
										<div class="col-md-2">
												<button class="btn btn-success" type="submit">查询</button>
												<button class="btn btn-danger"  type="button" onclick="exportExcel()">信息导出</button>
										</div>
									 </div>
								</form>
							<table id="listtable" class="table table-bordered table-striped table-condensed table-hover">
									<tr>
										<th>学生姓名</th>
										<th>学籍号</th>
										<th>身份证号</th>
										<th>性别</th>
										<th>出生日期</th>
										<th>年份</th>
										<th>学年</th>
										<th>学期</th>
										<th>资助名称</th>
										<th>资助金额</th>
										<th>发放日期</th>
										<th>发放人</th>
									</tr>
									  
									<c:forEach items="${pageInfo.list}" var="ct">
									<tr>
										<td>${ct.name}</td>
										<td>${ct.stucode }</td>
										<td>${ct.idcard}</td>
										<td>${ct.sex }</td>
										<td>${ct.birthday}</td>
										<td>${ct.year }</td>
										<td>${ct.studayyear}</td>
										<td>${ct.term}</td>
										<td>${ct.subname}</td>
										<td>${ct.subamount}</td>
										<td>${ct.providedate}</td>
										<td>${ct.provide}</td>
									</tr>
									</c:forEach>
		</table>
								<!-- 	分页 -->
								<my:page prePage="${pageInfo.prePage}" nextPage="${pageInfo.nextPage}"
				 url="${pageContext.request.contextPath}/datatotal/listsocietysub?n=1" totalPage="${pageInfo.pages }" currentPage="${pageInfo.pageNum}"/>
									 
							</div>
						</div><!-- 内容面板 end -->
					</div>
			 
</body>
<script type="text/javascript">
$(function () {
	 
	           //页面加载时，查询所有的 县
	            $.ajax({
					url : 'getAllZhen',
					type : "get",
					dataType : "json",
					success : function(data) {
						 
						$("#zid option:gt(0)").remove();
						for(var i=0;i<data.length;i++){
							var opt = "<option value='"+data[i].id+"'>"+data[i].name+"</optoin>";
							$("#zid").append(opt);
						}
					},
					error : function(xhr) {
						alert(xhr);
					}
				});
	     
	    $('.form_time').datetimepicker({
	        format: 'yyyy-mm-dd',
	        language:"zh-CN",
	        minView: "month",
	        autoclose: true,//选中自动关闭
	        todayBtn: true, //显示今日按钮
	        clearBtn : true,
	        pickerPosition: "bottom-left"
	       /*  locale: moment.locale('zh-cn') */
	    });
	            
	            
	  
	 
	 
	}); 
	  function changeZhen(obj){
			 //ajax  查询 公安县 下所有的镇 
			if(obj.value!=''){
				  $.ajax({
						url : '../ztree/getBaseInfo?pid='+obj.value,
						type : "get",
						dataType : "json",
						success : function(data) {
							if(data!=null){
								$("#schoolname option:gt(0)").remove();
								for(var i=0;i<data.length;i++){
									var opt = "<option value='"+data[i].name+"'>"+data[i].name+"</optoin>";
									$("#schoolname").append(opt);
								}
							}
						},
						error : function(xhr) {
							//alert(xhr.status);
						}
					});
			}	
		 }
	  //导出数据
	  function exportExcel(){
		  var beginDate = $("#beginDate").val();
		  var endDate = $("#endDate").val();
		  var project = $("#project").val();
		  var term = $("#term").val();
		  var zid = $("#zid").val();
		  var schoolname = $("#schoolname").val();
		  var name = $("#name").val();
		  var idcard = $("#idcard").val();
		  
		//  localhost.href="exportCountryExcel"
		//提交表单  改变表单的
		// $("#myform").action="exportCountryExcel";
		 $("#myform").attr("action","exportSocietyExcel");
		 $("#myform").submit();
		
	  }
/* 	  
document.documentElement.style.overflowY = 'hidden'; */
</script>
</html>